<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page language="java" import="com.tjtt.common.utils.DateUtilsAll"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String mainid = request.getParameter("mainid");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
     <base target="_self"/>
    <link rel="stylesheet" type="text/css" href="<%=path %>/web/style/layout.css" />
    <script type="text/javascript" src="<%=path %>/jqGrid/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="<%=path %>/jslib/jquery.validate.min.js"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/My97DatePicker/WdatePicker.js" defer="defer"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/jquery.form.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/additional-methods.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/demo.css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
    <c:if test="${requestScope.message!=null}">
		<script type="text/javascript">
 	 		     alert('<c:out value="${requestScope.message}"></c:out>');
 	 		     window.close();
 		</script>
	</c:if>
	<script type="text/javascript">
	var api = frameElement.api, W = api.opener;
    var stateValue="";
		$().ready(function(){
		
			var options = {
		  	    url:'<%=request.getContextPath() %>/shebeitouruAction!kezhangshenpi.action?steptype='+$("#steptype0").val()+'&taskinfoid='+${taskinfoid},
		  	     beforeSubmit: function() {
		   				return checking();
		    			},
		  	     dataType:'json',
		  	    success: function(data) {
		  	      if(data.result=='success'){
					alert("提交成功");
					api.close();
					W.refreshIt();
		  	      }
		  	    }
		  	   };
			$('#saveBtn').click(function(){
			alert(1);
			    	$('#pageFrom').ajaxSubmit(options);
	 	            return false;
    	 	});
	    	$('#closeBtn').click(function(){
	    		api.close();
				});
		});
	function checking(){
	   		var flag = true;
			var keshenpiren = $("#keshenpiren").val();
			var keshenpiyijian = $("#keshenpiyijian").val();
			var keshenpitime = $("#keshenpitime").val();
			if(keshenpiren ==null || keshenpiren == "" ){
				alert("审批人不能为空！");
				$("#keshenpiren").focus();
	    		return false;
			}
			if(keshenpiyijian == null && keshenpiyijian == ""){
				alert("审批意见不能为空！");
				$("#keshenpiyijian").focus();
	    		return false;
			}
			if(keshenpitime ==null || keshenpitime == "" ){
				alert("时间不能为空！");
				$("#keshenpitime").focus();
	    		return false;
			}
			
		}
		function dahui(){
        var actionUrl = '<%=request.getContextPath()%>/shebeitouruAction!tuihuishebei.action'; 
        var param = {
                      "flowname":$("#flowname").val(),
                      "flowid":"${flowid}",
                      "stateid":"${stateid}",
                      "steptypeback":$("#steptypeback0").val(),
                      "taskinfoid":"${taskinfoid}",
                      "id":$("#id").val()
            };
    	$.ajax({  
			        url : actionUrl,  
			        type : "post", 
			        data : param,  
			        dataType : "json",  
			        cache : false,  
			 error : function(textStatus, errorThrown) {  
			        alert("系统ajax交互错误: " + textStatus.value);  
		    },  
		    success : function(data, textStatus) {
		        if(data.ajaxResult=='success'){ 
		        //      window.returnValue = returnValue;     
				      alert("打回成功");
				      W.reload();
					  api.close();
                   }else{
                       alert("处理失败!");
                       W.reload();
                   }
		    }    
			});
    }
	</script>
	
	
  </head>
  
  <body>
  		<form id="pageFrom" action="" enctype="multipart/form-data" method="post">
        <input type="hidden" id="flag" name="flag" />
        <input type="hidden" name="flowid" id="flowid" value="${flowid}">
     	<input type="hidden" name="stateid" id="stateid" value="${stateid}">
     	${steptcontent}
     	${steptcontentback}
     	
  		<input type="hidden" readonly="readonly" id="id" name="id" value="${apply.id }"/>
  		<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew" style="padding-top: 20px">
  			 <tr>
			  	<td align="right">流程名称:</td>
			  <td align="left">
			  	<input type="text" id="flowname" name="flowname" maxlength="50" value="${flowname}" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;">
			  </td>
     		<td>
  			</tr>
  			<tr>
  			  <td align="right">标识号：</td>
  			  <td align="left">
  			    <input  type="text" id="biaozhihao" maxlength="50" name="biaozhihao" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeitouru.biaozhihao }" />
  			  </td>
  			  <td align="right">申请部门：</td>
  			  <td align="left">
  			    <input  type="text" id="shenqingbumen" maxlength="50" name="shenqingbumen" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeitouru.shenqingbumen }" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">申请人：</td>
  			  <td align="left">
  			    <input  type="text" id="shenqingren" maxlength="50" name="shenqingren" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeitouru.shenqingren }" />
  			  </td>
  			  <td align="right">申请时间：</td>
  			  <td align="left">
  			    <input  type="text" id="shenqingtime" maxlength="50" name="shenqingtime" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="${Shebeitouru.shenqingtime }" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">序号：</td>
  			  <td align="left">
  			    <input  type="text" id="xuhao" maxlength="50" name="xuhao" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeitouru.xuhao }" />
  			  </td>
  			  <td align="right">项目名称：</td>
  			  <td align="left">
  			    <input  type="text" id="xiangmuname" maxlength="50" name="xiangmuname"  style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeitouru.xiangmuname }" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">数量：</td>
  			  <td align="left">
  			    <input  type="text" id="shuliang" maxlength="50" name="shuliang" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeitouru.shuliang }" />
  			  </td>
  			  <td align="right">预交付日期：</td>
  			  <td align="left">
  			    <input  type="text"  id="yujiaofutime" maxlength="50" name="yujiaofutime" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeitouru.yujiaofutime }" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">项目负责人：</td>
  			  <td align="left">
  			    <input  type="text" id="xiangmufuzeren" maxlength="50" name="xiangmufuzeren" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeitouru.xiangmufuzeren }" />
  			  </td>
  			  <td align="right">联系方式：</td>
  			  <td align="left">
  			  	 <input  type="text" id="lianxifangshi" maxlength="50"  name="lianxifangshi" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeitouru.lianxifangshi }" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">主责领导</td>
  			  <td align="left">
  			    <input  type="text" id="zhuzelingdao" maxlength="50" name="zhuzelingdao" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeitouru.zhuzelingdao }" />
  			  </td>
  			  <td align="right">现有设备使用情况：</td>
  			  <td align="left">
  			    <input  type="text" id="xianyouequ" maxlength="50" name="xianyouequ" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeitouru.xianyouequ }" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">原因描述:</td>
  			  <td align="left">
  			    <input  type="text"  id="yuanyinmiaoshu"  maxlength="50" name="yuanyinmiaoshu" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeitouru.yuanyinmiaoshu }" />
  			  </td>
  			  <td align="right">附件：</td>
  			  <td align="left">
  			  	<div><a target=_blank href='shebeitouruAction!fileDownload.action?id=${shebeitouru.id }'>${Shebeitouru.fujian }</a></div>
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">审批人:</td>
  			  <td align="left">
  			    <input  type="text"  id="keshenpiren"  maxlength="50" name="keshenpiren" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="<%=session.getAttribute("username") %>" />
  			  </td>
  			  <td align="right">审批时间：</td>
  			  <td align="left">
  			    <input  type="text"  id="keshenpitime"  maxlength="50" name="keshenpitime" onChange="changeDate()" onClick="WdatePicker({maxDate:new Date()})" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="<%=DateUtilsAll.dateToStringShort(new Date()) %>" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">审批意见:</td>
  			  <td align="left">
  			   <textarea rows="5" cols="100" id="keshenpiyijian" name="keshenpiyijian" onkeydown="countlen1(this);" style="width: 250px;"></textarea>
  			  </td>
  			</tr>
 			
		</table>
		<table width="100%" border="0" align="center" class="formTableNew">
		  <tr>   
			<td align="center">
		    	<input id="saveBtn" type="button" value="提 交" class="form_bt_orange" />
		    	<input type="button" id="backBtn" onclick="dahui()" value="退回" class="form_bt_orange" />
		    	<input type="button" id="closeBtn" value="取 消" class="form_bt_grey" />
		    </td>
		  </tr>
		</table>
	<!--表单结束-->
	</form>
  </body>
</html>
